package net.zjitc.springboot_mybatisplus.service.Impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import net.zjitc.springboot_mybatisplus.dao.BookDao;
import net.zjitc.springboot_mybatisplus.domain.Book;
import net.zjitc.springboot_mybatisplus.service.BookService;
import org.springframework.stereotype.Service;

@Service
public class BookServiceImpl extends ServiceImpl<BookDao, Book> implements BookService {


    @Override
    public void updateBookToScience() {
        //创建条件构造器 设置条件
        QueryWrapper<Book> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("type","math");

        //创建Book对象，修改其type属性
        Book book = new Book();
        book.setType("science");

        //根据条件 对满足条件的对象进行修改属性
        this.update(book, queryWrapper);
    }

    /*@Override
    public void customMethod() {

    }*/
}
